package com.gomyb.result;

/**
 * @author <a href="mailto:HelloHeSir@gmail.com">Mr_He</a>
 */
public class R {

    public static Result OK() {
        return new OKResult();
    }

    public static Result OK(Object data) {
        return new OKResult(data);
    }

    public static Result OK(RCode r) {
        return new OKResult().setMsg(r.getMsg()).setCode(r.getCode());
    }

    public static Result OK(RCode r, Object data) {
        return new OKResult().setMsg(r.getMsg()).setCode(r.getCode()).setData(data);
    }

    public static Result OK(String msg, Object data) {
        return new OKResult(msg, data);
    }

    // =========成功↑==========失败↓===============================================

    public static Result NO() {
        return new NOResult();
    }

    public static Result NO(String msg) {
        return new NOResult(msg);
    }

    public static Result NO(RCode r) {
        return new NOResult().setMsg(r.getMsg()).setCode(r.getCode());
    }

    public static Result NO(RCode r, String msg) {
        return new NOResult().setCode(r.getCode()).setMsg(msg);
    }

}